/**
 * 打开文件选择对话框
 */
import common from '../../tnxet-common.js';
import {dialog} from 'electron';

export default {
    name: common.event.dialog.save,
    listen(options) {
        return new Promise((resolve, reject) => {
            dialog.showSaveDialog(options).then(result => {
                if (!result.canceled) {
                    resolve(result.filePath);
                }
            }).catch(error => {
                reject(error);
            });
        });
    },
}
